cmake_minimum_required(VERSION 3.0)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

#set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_VERBOSE_MAKEFILE ON)

project(free_view_demo)

set(Ffmpeg_DIR ../thirdparty/ffmpeg)
set(Ffmpeg_INCLUDE_DIRS ${Ffmpeg_DIR}/include)
file(GLOB_RECURSE Ffmpeg_LIBS ${Ffmpeg_DIR}/lib/*)

#message(STATUS "Ffmpeg library status:")
message(STATUS "    version: ${Ffmpeg_VERSION}")
#message(STATUS "    libraries: ${Ffmpeg_LIBS}")
#message(STATUS "    include path: ${Ffmpeg_INCLUDE_DIRS}")

find_package(Threads REQUIRED)

SET(PLATFORM_SPECIFIC_LIBS "-lpthread -lswscale -lswresample -lavformat -lavdevice -lavcodec -lavutil -lavfilter -lm")

add_library(mux_library SHARED 
    ../mux/mux.cpp
)

target_include_directories(mux_library
    PUBLIC 
        ../mux
        ${Ffmpeg_INCLUDE_DIRS}
)

target_link_libraries(mux_library ${Ffmpeg_LIBS})

include_directories(
        ${Ffmpeg_INCLUDE_DIRS}
        ../mux
)

add_executable(demo main.cpp)

target_link_libraries(demo ${Ffmpeg_LIBS}  mux_library Threads::Threads)
